<template>
  <div class="product-mg">
    <el-container>
      <el-header
        style="padding: 0px;display:flex;justify-content:space-between;align-items: center">
        <div style="display: inline" class="search-p">
          <!-- <el-input
            placeholder="请输入产品名称"
            clearable
            style="width: 300px;margin: 0px;padding: 0px;"
            size="mini"
            :disabled="advanceSearchViewVisible"
            @keyup.enter.native="searchEmp"
            prefix-icon="el-icon-search"
            v-model="productName"
          ></el-input> -->
          <el-select
              v-model="productName"
              filterable
              remote
              multiple
              :reserve-keyword="true"
              :disabled="advanceSearchViewVisible"
              @keyup.enter.native="searchEmp"
              placeholder="请输入产品名称"
              :remote-method="inputProductNameMethod"
              :loading="inputProductNameLoading"
              @change="productNameChange" clearable>
              <el-option
                v-for="item in productNameArray"
                :key="item.productId"
                :label="item.productName+' '+item.productNo"
                :value="item.productName"
              >
              </el-option>
          </el-select>
          <el-button
            type="primary"
            size="mini"
            style="margin-left: 5px"
            icon="el-icon-search"
            @click="searchEmp"
          >搜索</el-button>
          <el-button
            slot="reference"
            type="primary"
            size="mini"
            style="margin-left: 5px"
            @click="showAdvanceSearchView"
          >
            <i
              class="fa fa-lg"
              v-bind:class="[
                advanceSearchViewVisible ? faangledoubleup : faangledoubledown
              ]"
              style="margin-right: 5px"
            ></i>高级搜索
          </el-button>
        </div>
      </el-header>
      <el-main style="padding-left: 0px;padding-top: 0px">
        <div>
          <transition name="slide-fade">
            <div
              style="margin-bottom: 10px;border: 1px;border-radius: 5px;border-style: solid;padding: 5px 0px 5px 0px;box-sizing:border-box;border-color: #20a0ff"
              v-show="advanceSearchViewVisible"
            >
              <el-row>
                <el-col :span="1" style="height:30px;"></el-col>
                <el-col :span="8" align="left">
                  <span>录入时间:</span>
                  <el-date-picker
                    v-model="inputTime"
                    size="mini"
                    type="daterange"
                    style="width: 60%"
                    value-format="yyyy-MM-dd"
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                  ></el-date-picker>
                </el-col>
                <el-col :span="8" align="left">
                  <span>开卖日期</span>
                  <el-date-picker
                    v-model="saleTime"
                    size="mini"
                    type="daterange"
                    style="width: 60%"
                    value-format="yyyy-MM-dd"
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                  ></el-date-picker>
                </el-col>
                
              </el-row>
              <el-row>
                <el-col :span="1" style="height:30px;"></el-col>
                <el-col :span="12" align="left">
                  <el-button icon="el-icon-search" type="primary" size="mini" @click="searchEmp">搜索</el-button>
                  <el-button size="mini" @click="cancelSearch">取消</el-button>
                </el-col>
              </el-row>
            </div>
          </transition>
          <el-table
            :data="emps"
            v-loading="tableLoading"
            border
            stripe
            size="mini"
            style="width: 100%"
          >
            <el-table-column prop="productName" align="left" fixed label="产品名称" width="150"></el-table-column>
            <el-table-column prop="saleDate" align="left" fixed label="产品开卖日期" width="90"></el-table-column>
            <el-table-column prop="firstReceiptData" align="left" fixed label="第一笔到账日" width="90"></el-table-column>
            <el-table-column prop="lastReceiptData" align="left" fixed label="最后一笔到账日" width="90"></el-table-column>
            <el-table-column prop="standardCoefficient" width="120" align="left" label="第一年折标系数"></el-table-column>
            <el-table-column prop="standardCoefficientSub" width="120" align="left" label="第二年折标系数"></el-table-column>
            <el-table-column prop="standardCoefficientSub3" width="120" align="left" label="折标系数"></el-table-column>
            <el-table-column prop="standardCoefficientSub4" width="120" align="left" label="第四年折标系数"></el-table-column>
            <el-table-column prop="pcFeeFormulaCn" label="服务费计算公式" width="160"></el-table-column>
            <el-table-column width="85" align="left" label="预期投资收益">
              <template slot-scope="scope">
                <span @click="lookThing(scope.$index)">查看</span>
              </template>
            </el-table-column>
            <el-table-column width="150" label="预期投资退出日">
              <template slot-scope="scope">
                {{
                scope.row.actualInvestmentExitDateCn
                ? scope.row.actualInvestmentExitDateCn
                : scope.row.lastInvestmentExitDateCn
                }}
              </template>
            </el-table-column>
            <el-table-column width="120" label="资产转让总价款（万）">
              <template slot-scope="scope">
                {{
                scope.row.totalAssets / 10000
                }}
              </template>
            </el-table-column>
            <el-table-column prop="productType" label="产品类型(1+1/普通产品)" width="150">
              <template slot-scope="scope">
                {{
                scope.row.productType == 0 ? "普通产品" : "1+X产品"
                }}
              </template>
            </el-table-column>
            <el-table-column width="300" align="left" label="募集账户" show-overflow-tooltip>
              <template slot-scope="scope">
                <p>户名： {{ scope.row.accountName }}</p>
                <p>账号：{{ scope.row.accountNo }}</p>
                <p>开户行：{{ scope.row.openAccountBank }}</p>
              </template>
            </el-table-column>
            <el-table-column prop="earlyReminderTime" width="120" label="提前提醒时间"></el-table-column>
            <el-table-column prop="createdTime" align="left" width="160" label="产品录入时间"></el-table-column>
            <el-table-column width="100" align="left" prop="createdBy" label="产品录入人"></el-table-column>
            <el-table-column fixed="right" label="操作" width="200" align="center">
              <template slot-scope="scope">
                <el-button
                  @click="showEditEmpView(scope.row)"
                  style="padding: 3px 4px 3px 4px;margin: 2px"
                  type="primary"
                >查看</el-button>
                <el-button type="success" style="padding: 3px 4px 3px 4px;margin: 2px" @click="trialSetting(scope.row)">试算设置</el-button>
                <el-button type="warning" style="padding: 3px 4px 3px 4px;margin: 2px"
                 :disabled="common.isNull(scope.row.trialInvestmentExitDate) && common.isNull(scope.row.trialInvestmentExitTime)" 
                 @click="trialAdministration(scope.row)">试算管理</el-button>
                 <el-button type="info" style="padding: 3px 4px 3px 4px;margin: 2px" @click="productInfo(scope.row)">产品汇总</el-button>
              </template>
            </el-table-column>
          </el-table>
          <div style="display: flex;justify-content: center;margin: 40px 0">
            <el-pagination
              background
              :page-size="pageSize"
              :current-page="currentPage"
              @current-change="currentChange"
              layout="prev, pager, next"
              :total="totalCount"
            ></el-pagination>
          </div>
          <div
            style="margin:30px 0;"
            class="fw tc"
          >共{{Math.ceil(totalCount/pageSize)}}页,{{totalCount}}条信息</div>
        </div>
      </el-main>
    </el-container>
    <el-form :model="emp" :disabled="true" style="margin: 0px;padding: 0px;">
      <div style="text-align: left">
        <el-dialog
          :title="dialogTitle"
          style="padding: 0px;"
          @close="closeModal"
          :visible.sync="dialogVisible"
          width="1100px"
          
          :loading="tableLoading">
          <el-row>
            <el-col :span="7">
              <div>
                <el-form-item label="产品名称:" prop="productName">
                  <el-input
                    prefix-icon="el-icon-edit"
                    v-model="emp.productName"
                    size="mini"
                    style="width: 60%"
                    placeholder="请输入产品名称"
                  ></el-input>
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="9">
              <div>
                <el-form-item label="服务费公式:" prop="pcFeeFormula">
                  <el-select
                    v-model="emp.pcFeeFormula"
                    placeholder="请选择"
                    size="mini"
                  >
                    <el-option
                      v-for="item in pcFeeFormulaInfo"
                      :key="item.indexVal"
                      :label="item.label"
                      style="width: 120px"
                      :value="item.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </div>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <div>
                <el-form-item label="第一年折标系数:" prop="standardCoefficient">
                  <el-input
                    onKeyPress="if (event.keyCode!=46 && event.keyCode!=45 && event.keyCode<48 || event.keyCode>57)) event.returnValue=false"
                    prefix-icon="el-icon-edit"
                    v-model="emp.standardCoefficient"
                    size="mini"
                    style="width: 180px"
                    placeholder="请输入第一年折标系数"
                  ></el-input>
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="12">
              <div>
                <el-form-item label="第二年折标系数:" prop="standardCoefficient">
                  <el-input
                    onKeyPress="if (event.keyCode!=46 && event.keyCode!=45 && event.keyCode<48 || event.keyCode>57)) event.returnValue=false"
                    prefix-icon="el-icon-edit"
                    v-model="emp.standardCoefficientSub"
                    size="mini"
                    style="width: 180px"
                    placeholder="请输入第二年折标系数"
                  ></el-input>
                </el-form-item>
              </div>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <div>
                <el-form-item label="第三年折标系数:" prop="standardCoefficient">
                  <el-input
                    onKeyPress="if (event.keyCode!=46 && event.keyCode!=45 && event.keyCode<48 || event.keyCode>57)) event.returnValue=false"
                    prefix-icon="el-icon-edit"
                    v-model="emp.standardCoefficientSub3"
                    size="mini"
                    style="width: 180px"
                    placeholder="请输入第三年折标系数"
                  ></el-input>
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="12">
              <div>
                <el-form-item label="第四年折标系数:" prop="standardCoefficient">
                  <el-input
                    onKeyPress="if (event.keyCode!=46 && event.keyCode!=45 && event.keyCode<48 || event.keyCode>57)) event.returnValue=false"
                    prefix-icon="el-icon-edit"
                    v-model="emp.standardCoefficientSub4"
                    size="mini"
                    style="width: 180px"
                    placeholder="请输入第四年折标系数"
                  ></el-input>
                </el-form-item>
              </div>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <div>
                <el-form-item label="预期收益公式:" prop="incomFromInvestmentFormula">
                  <el-select
                    v-model="emp.incomFromInvestmentFormula"
                    placeholder="请选择"
                    size="mini"
                  >
                    <el-option
                      v-for="item in incomFromInvestmentFormulaInfo"
                      :key="item.indexVal"
                      :label="item.label"
                      :value="item.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="8">
              <div>
                <el-form-item label="产品编号:" prop="productNo">
                  <el-input
                    prefix-icon="el-icon-edit"
                    v-model="emp.productNo"
                    size="mini"
                    style="width: 60%"
                    placeholder="产品编号"
                  ></el-input>
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="8">
              <div>
                <el-form-item label="到期类型:">
                  <el-select
                    v-model="emp.exitType"
                    placeholder="请选择"
                    size="mini"
                  >
                    <el-option
                      v-for="item in exitTypeArr"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </div>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <div>
                <el-form-item label="预期退出天数:" prop="lastInvestmentExitDate">
                  <el-input
                    onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')"
                    v-model="emp.lastInvestmentExitDate"
                    size="mini"
                    style="width: 50%"
                    placeholder="预期退出天数"
                  ></el-input>
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="8" v-if="emp.exitType=='00'">
              <div>
                <el-form-item label="实际最迟退出天数:">
                  <el-input
                    :disabled="dialogTitle === '录入产品'"
                    onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')"
                    v-model="emp.actualInvestmentExitDate"
                    size="mini"
                    style="width: 50%"
                    placeholder="实际最迟退出天数"
                  ></el-input>
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="8" v-if="emp.exitType=='01'">
              <div>
                <el-form-item label="实际最迟投资退出日期:">
                  <el-date-picker
                    :disabled="dialogTitle === '录入产品'"
                    v-model="emp.actualInvestmentExitTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="实际最迟投资退出日期">
                  </el-date-picker>
                </el-form-item>
              </div>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <div>
                <el-form-item label="资产转让总价款:" prop="totalAssets">
                  <el-input
                    onKeyPress="if (event.keyCode!=46 && event.keyCode!=45 && event.keyCode<48 || event.keyCode>57)) event.returnValue=false"
                    prefix-icon="el-icon-edit"
                    v-model="emp.totalAssets"
                    size="mini"
                    style="width: 60%"
                    placeholder="资产转让总价款"
                  ></el-input>
                </el-form-item>
              </div>
            </el-col>         
            <el-col :span="12">
              <div>
                <el-form-item label="账户名:" prop="accountName">
                  <el-input
                    prefix-icon="el-icon-edit"
                    v-model="emp.accountName"
                    size="mini"
                    style="width: 60%"
                    placeholder="账户名"
                  ></el-input>
                </el-form-item>
              </div>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <span>产品开卖日期:</span>
              <el-date-picker
                v-model="emp.saleDate"
                type="date"
                size="mini"
                value-format="yyyy-MM-dd"
                placeholder="选择日期"
              ></el-date-picker>
            </el-col>
            <!-- <el-col :span="8">
              <el-form-item label="第一笔到账日:" >
                {{emp.firstReceiptData}}
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="最后一笔到账日:" >
                {{emp.lastReceiptData}}
              </el-form-item>
            </el-col> -->
          </el-row>
          <el-row>
            <el-col :span="8">
              <div>
                <el-form-item label="账号:" prop="accountNo">
                  <el-input
                    onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')"
                    prefix-icon="el-icon-edit"
                    v-model="emp.accountNo"
                    size="mini"
                    style="width: 60%"
                    placeholder="账号"
                  ></el-input>
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="8">
              <div>
                <el-form-item label="开户行:" prop="openAccountBank">
                  <el-input
                    prefix-icon="el-icon-edit"
                    v-model="emp.openAccountBank"
                    size="mini"
                    style="width: 60%"
                    placeholder="开户行"
                  ></el-input>
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="8">
              <div>
                <el-form-item label="提前提醒时间:" prop="earlyReminderTime">
                  <el-input
                    prefix-icon="el-icon-edit"
                    v-model="emp.earlyReminderTime"
                    size="mini"
                    style="width: 50%"
                    placeholder="提前提醒时间"
                  ></el-input>
                </el-form-item>
              </div>
            </el-col>
          </el-row>
        </el-dialog>
      </div>
    </el-form>
    <!-- 预期投资收益 -->
    <el-dialog title="预期投资收益" :visible.sync="dialogSaleShow">
      <el-table :data="gridData" border>
        <el-table-column property="money" label="受让资产总额（万元）"></el-table-column>
        <el-table-column label="资产预期年化一期收益率（%/年）">
          <template slot-scope="scope">{{ scope.row.year }}%</template>
        </el-table-column>
      </el-table>
      <el-table :data="gridData2" border v-if="gridData2.length >= 1">
        <el-table-column property="money" label="受让资产总额（万元）"></el-table-column>
        <el-table-column label="资产预期年化二期收益率（%/年）">
          <template slot-scope="scope">{{ scope.row.year }}%</template>
        </el-table-column>
      </el-table>
      <el-table :data="gridData3" border v-if="gridData3.length >= 1">
        <el-table-column property="money" label="受让资产总额（万元）"></el-table-column>
        <el-table-column label="资产预期年化三期收益率（%/年）">
          <template slot-scope="scope">{{ scope.row.year }}%</template>
        </el-table-column>
      </el-table>
    </el-dialog>
    <!-- 产品汇总 -->
    <el-dialog title="产品汇总" :visible.sync="productInfoShow" :close-on-click-modal="false"	>
      <el-row style="height:50px;line-height:50px;">
        <el-col :span="12">利息:{{productinfo.expectInvestmentIncome}}</el-col>
        <el-col :span="12">本息合计:{{productinfo.expectTotalRevenue}}</el-col>
      </el-row>
      <el-row style="height:50px;line-height:50px;">
        <el-col :span="12">合计金额本金:{{productinfo.totalAssetsSummary}}</el-col>
        <el-col :span="12">财顾费总数:{{productinfo.totalPcFeeSummary}}</el-col>
      </el-row>
    </el-dialog>
    <!-- 试算设置 -->
    <el-dialog title="试算设置" :visible.sync="trialSettingShow" :close-on-click-modal="false"	>
      <el-row>
        <el-col :span="10" align="right">
          <span>到期类型:</span>
        </el-col>
        <el-col :span="14" align="left">
          <el-select
            v-model="trialExitType"
            placeholder="请选择" style="margin-top:-20px;margin-left:30px;width:60%;"
            size="mini" @change="trialExitTypeChange">
            <el-option
              v-for="item in exitTypeArr"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            ></el-option>
          </el-select>  
        </el-col>      
      </el-row>
      <el-row v-if="trialExitType=='00'" style="margin-top:30px;">
        <el-col :span="10" align="right">
          <span>试算投资退出天数:</span>
        </el-col>
        <el-col :span="14" align="left">
          <el-input placeholder="请输入试算投资退出天数" clearable
             style="margin-top:-20px;margin-left:30px;width:60%;"
             v-model="trialInvestmentExitDate"></el-input>
        </el-col>
      </el-row>
      <el-row v-if="trialExitType=='01'" style="margin-top:30px;">
        <el-col :span="10" align="right">
          <span>试算投资退出日期:</span>
        </el-col>
        <el-col :span="14" align="left">
          <el-date-picker
            v-model="trialInvestmentExitTime" style="margin-top:-20px;margin-left:30px;width:60%;"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择试算投资退出日期">
          </el-date-picker>
        </el-col>
      </el-row>
      <el-row style="margin-top:20px;">
        <el-col :span="10" align="right">
          <span>试算开始日期:</span> 
        </el-col>
        <el-col :span="14" align="left">
          <el-date-picker
            v-model="trialStartDate" style="margin-top:-20px;margin-left:30px;width:60%;"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择试算开始日期">
          </el-date-picker>
        </el-col>
      </el-row>
      <el-row style="margin-top:20px;">
        <el-col :span="10" align="right">
          <span>银行到账日:</span> 
        </el-col>
        <el-col :span="14" align="left">
          <el-date-picker
            v-model="trialBankReceivedDate" style="margin-top:-20px;margin-left:30px;width:60%;"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            value-format="yyyy-MM-dd"
            placeholder="请选择试算开始日期">
          </el-date-picker>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="8" style="height:30px;"></el-col>
        <el-col :span="8" style="height:30px;"></el-col>
        <el-col :span="8" align="right">
          <el-button type="primary" :disabled="trialSettingLoading" :loading="trialSettingLoading" @click="sureTrialSetting">确定</el-button>
        </el-col>
      </el-row>
    </el-dialog>
    <!-- 试算管理 -->
    <el-dialog title="试算管理" :visible.sync="trialAdministrationShow" :fullscreen="true" :before-close="closeTrialAdministration"
    width="1100px">
      <el-row>
        <el-col :span="12" align="left">
          <el-button type="primary" size="mini" style="margin-left: 5px" @click="trialAdministrationSearchShow=!trialAdministrationSearchShow">
            <i class="fa fa-lg" v-bind:class="[trialAdministrationSearchShow ? faangledoubleup:faangledoubledown]"
                style="margin-right: 5px"></i>
            展开搜索条件
          </el-button>
        </el-col>
        <el-col :span="4" style="height:30px;"></el-col>
        <el-col :span="4" style="height:30px;"></el-col>
        <el-col :span="4" align="right">
          <el-button type="success" size="mini" @click="exportInfo" class="fl" style="margin:0 15px;">
              <i class="el-icon-download" style="margin-right: 5px"></i>导出客户信息
          </el-button>
        </el-col>
      </el-row>
      <!-- 高级搜索 -->
      <transition name="slide-fade">   
        <div v-show="trialAdministrationSearchShow" class="senior"> 
            <el-row>
              <el-col :span="8">
                  <span>合同编号:</span>
                  <el-input
                    placeholder="请输入合同编号"
                    v-model="senior.contractNo"
                    clearable>
                  </el-input>
              </el-col>
              <el-col :span="8">
                <span>合同状态:</span>
                <el-select v-model="senior.status" clearable placeholder="请选择">
                  <el-option
                    v-for="item in senior.statusArray"
                    :key="item"
                    :label="item"
                    :value="item">
                  </el-option>
                </el-select>
              </el-col>
              <el-col :span="8">
                <span>客户姓名:</span>
                <el-input
                  placeholder="请输入姓名"
                  v-model="senior.customerName"
                  clearable>
                </el-input>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8">
                  <span>身份证:</span>
                  <el-input
                    placeholder="请输入身份证"
                    v-model="senior.idcard"
                    clearable>
                  </el-input>
              </el-col>
              <el-col :span="8">
                  <span>服务人员:</span>
                  <el-select
                    v-model="senior.salemanName"
                    filterable
                    remote
                    placeholder="请输入服务人员"
                    :remote-method="inputsalemanNameMethod"
                    :loading="senior.inputsalemanNameLoading"
                    @change="salemanNameChange" clearable>
                    <el-option
                      v-for="item in senior.inputsalemanNameArray"
                      :key="item.salemanId"
                      :label="item.area+item.part+item.group+item.salemanName"
                      :value="item.salemanName"
                    >
                    </el-option>
                  </el-select>
              </el-col>
              <el-col :span="8">
                <span>资产转让生效日:</span>
                <el-date-picker
                  v-model="senior.AssetsTransferEffDate"
                  type="daterange"
                  range-separator="至"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期"
                  value-format="yyyy-MM-dd"
                >
                </el-date-picker>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8">
                <span>录入时间段:</span>  
                <el-date-picker
                  v-model="senior.InputTime"
                  type="daterange"
                  range-separator="至"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期"
                  value-format="yyyy-MM-dd"
                >
                </el-date-picker>
              </el-col>
              <el-col :span="8">
                <span>回执回销时间段:</span>  
                <el-date-picker
                  v-model="senior.ReceiptSellBackTime"
                  type="daterange"
                  range-separator="至"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期"
                  value-format="yyyy-MM-dd"
                  >
                </el-date-picker>
              </el-col>
              <el-col :span="8">
                <span>最迟退出日:</span>    
                <el-date-picker
                  v-model="senior.LastInvestmentExitTiem"
                  type="daterange"
                  range-separator="至"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期"
                  value-format="yyyy-MM-dd"
                  >
                </el-date-picker>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8">
                <span>银行到账日期:</span>    
                <el-date-picker
                  v-model="senior.BankReceivedDate"
                  type="daterange"
                  range-separator="至"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期"
                  value-format="yyyy-MM-dd"
                  >
                </el-date-picker>
              </el-col>
              <el-col :span="8">
                <span>实际投资退出日:</span>    
                <el-date-picker
                  v-model="senior.RealInvestmentExitDate"
                  type="daterange"
                  range-separator="至"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期"
                  value-format="yyyy-MM-dd"
                  >
                </el-date-picker>
              </el-col>
              <el-col :span="8">
                <span>手机号:</span>  
                <el-input
                    placeholder="请输入手机号"
                    v-model="senior.phone"
                    clearable>
                  </el-input>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8">
                <span>录入人：</span>
                <el-select v-model="senior.createdId" clearable placeholder="请选择录入人">
                  <el-option
                    v-for="item in senior.createdManArray"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id">
                  </el-option>
                </el-select>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8">
                <el-button icon="el-icon-search" type="primary" size="mini" @click="sureTrialAdministrationSearch">搜索</el-button>
                <el-button size="mini" @click="trialAdministrationSearchShow=false">取消</el-button>
              </el-col>
            </el-row>  
        </div>
      </transition>
      <el-table
              :data="trialTable"
              v-loading="trialTableLoading"
              border
              :lazy="true"
              stripe 
              size="mini"
              height="500"
              :highlight-current-row="true"
              style="width: 100%;margin-top:30px;">
              <el-table-column
                label="合同编号"
                prop="contractNo"
                align="center"
                fixed
                width="120">
              </el-table-column>
              <el-table-column
                align="center"
                prop="createdTime"
                label="录入时间"
                width="150">
              </el-table-column>
              <el-table-column
                width="120"
                align="center"
                fixed
                label="产品名称"
                prop="productName">
              </el-table-column>
              <el-table-column
                width="85"
                align="center"
                label="录入人"
                prop="createdBy">
              </el-table-column> 
              <el-table-column
                width="100"
                align="center"
                fixed
                label="资产受让人"
                prop="customerName">
              </el-table-column>
              <el-table-column
                align="center"
                width="70"
                label="新老客户"
                prop="customerType">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="身份证号"
                prop="idCard">
              </el-table-column>
              <el-table-column
                width="100"
                label="生日"
                align="center"
                prop="birthday">
              </el-table-column>
              <el-table-column
                label="年龄"
                align="center"
                prop="age">
              </el-table-column>
              <el-table-column
                label="性别"
                prop="sex"
                align="center">
              </el-table-column>
              <el-table-column
                width="100"
                align="center"
                label="联系电话"
                prop="telPhone">
              </el-table-column>
              <el-table-column
                width="300"
                align="center"
                label="联系地址"
                prop="address">
              </el-table-column>
              <el-table-column
                width="180"
                align="center"
                label="打款账号"
                prop="payBankCard">
              </el-table-column>
              <el-table-column
                width="220"
                align="center"
                label="打款银行开户行"
                prop="payOpeningBank">
              </el-table-column>
              <el-table-column
                width="180"
                align="center"
                label="收款账号"
                prop="receiveBankCard">
              </el-table-column>              
              <el-table-column
                align="center"
                width="220"
                label="收款银行开户行"
                prop="receiveOpeningBank">
              </el-table-column>
              <el-table-column
                width="100"
                align="center"
                label="资产转让总额"
                prop="totalAssets">
              </el-table-column>
              <el-table-column
                align="center"
                width="100"
                label="银行到账金额"
                prop="bankEceivedAmount">
              </el-table-column>
              <el-table-column
                align="center"
                width="100"
                label="银行手续费"
                prop="bankFee">
              </el-table-column>
              <el-table-column
                width="85"
                align="center"
                label="预期收益率(%)"
                prop="returnRate">
              </el-table-column>
              <el-table-column
                align="center"
                width="100"
                label="银行打款日期"
                prop="payDate">
              </el-table-column>
              <el-table-column
                align="center"
                width="100"
                label="银行到账日期"
                prop="bankReceivedDate">
              </el-table-column>
              <el-table-column
                width="120"
                align="center"
                label="资产转让生效日"
                prop="assetsTransferEffDate">
              </el-table-column>
              <el-table-column
                width="95"
                align="center"
                label="服务人员"
                prop="salemanInfo.salemanName">
              </el-table-column>
              <el-table-column
                width="95"
                align="center"
                label="区"
                prop="salemanInfo.area">
              </el-table-column>
              <el-table-column
                width="95"
                align="center"
                label="部"
                prop="salemanInfo.part">
              </el-table-column>
              <el-table-column
                width="95"
                align="center"
                label="组"
                prop="salemanInfo.group">
              </el-table-column>
              <el-table-column
                align="center"
                label="付款方式"
                prop="investmentType">
              </el-table-column>
              <el-table-column
                width="120"
                align="center"
                label="预期投资退出日"
                prop="expectInvestmentExitDate">
              </el-table-column>  
              <el-table-column
                width="150"
                align="center"
                label="标准业务折标系数"
                prop="standardCoefficient">
              </el-table-column> 
              <el-table-column
                align="center"
                width="150"
                label="回执回销时间"
                prop="receiptSellBackTime">
              </el-table-column>             
              <el-table-column
                align="center"
                width="150"
                label="财务审核时间"
                prop="financeCheckTime">
              </el-table-column>     
              <el-table-column
                align="center"
                width="150"
                label="是否启用试算数据"
                prop="isEnableTrialData">
              </el-table-column> 
              <el-table-column
                width="120"
                align="center"
                label="预期退出天数"
                prop="lastInvestmentExitDate">
              </el-table-column>
              <el-table-column
                width="120"
                align="center"
                label="投资者预期收益"
                prop="expectInvestmentIncome">
              </el-table-column>
              <el-table-column
                width="120"
                align="center"
                label="预期分配总额"
                prop="expectTotalRevenue">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="人民币（大写）"
                prop="expectTotalRevenueCap">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="实际投资退出日"
                prop="realInvestmentExitDate">
              </el-table-column>
              <el-table-column
                width="100"
                align="center"
                label="实际投资期限"
                prop="actualInvestmentExitDate">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="投资者实际收益"
                prop="realInvestmentIncome">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="实际投资退出日本息总额"
                prop="realTotalRevenue">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="人民币（大写）"
                prop="realTotalRevenueCap">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="财顾费总额"
                prop="totalPcFee">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="标准业绩"
                prop="standardCoefficientFee">
              </el-table-column>
              <el-table-column
                width="100"
                align="center"
                label="存续投资金额"
                prop="subsistTotalRevenue">
              </el-table-column>
              <el-table-column
                width="100"
                align="center"
                label="存续标准业绩"
                prop="subsistCoefficient">
              </el-table-column>
              <el-table-column
                width="100"
                align="center"
                label="积分"
                prop="integral">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                prop="expectInvestmentIncome1"
                label="预期第一期收益">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                prop="expectInvestmentIncome2"
                label="预期第二期收益">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                prop="expectInvestmentIncome3"
                label="预期第三期收益">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                prop="realInvestmentIncome1"
                label="实际第一期收益">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                prop="realInvestmentIncome2"
                label="实际第二期收益">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                prop="realInvestmentIncome3"
                label="实际第三期收益">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="风控审核时间"
                prop="riskerCheckTime">
              </el-table-column>
              <el-table-column
                align="center"
                width="150"
                label="驳回时间"
                prop="rejectionTime"
                >
              </el-table-column>
              <el-table-column
                width="200"
                align="center"
                label="驳回理由"
                prop="remark"
                :show-overflow-tooltip="true">
              </el-table-column>
              <el-table-column
                align="center"
                width="120"
                label="状态"
                fixed="right"
                prop="status">
              </el-table-column>
              <el-table-column
                fixed="right"
                align="center"
                label="操作"
                width="150">
                <template slot-scope="scope">
                  <el-button style="padding: 3px 4px 3px 4px;margin: 2px" type="primary"
                    size="mini" @click="showTrialAdministrationInfo(scope.row)">查看信息
                  </el-button>
                </template>
              </el-table-column>
      </el-table>
      <el-pagination
          background
          :page-size="trialPageSize"
          :current-page="trialCurrentPage"
          @current-change="trialCurrentChange"
          layout="prev, pager, next"
          :total="trialTotalCount"
          style="margin:50px;">
      </el-pagination>
      <div style="margin:30px 0;" class="fw">共{{Math.ceil(trialTotalCount/trialPageSize)}}页,{{trialTotalCount}}条信息</div>
      <el-dialog width="1100px" title="查看信息" append-to-body :visible.sync="trialAdministrationInfoShow">
          <!-- 试算管理具体信息表 -->
          <el-form :model="form"  ref="form">
              <el-row>
                <el-col :span="8">
                  <el-form-item label="合同编号:">
                      {{form.contractNo}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="产品名称:" >
                    {{form.productName}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="折标系数:" >
                    {{form.standardCoefficient}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="资产受让人:">
                      {{form.customerName}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="身份证号:">
                      {{form.idCard}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="新老客户:">
                      {{form.customerType}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="生日:">
                      {{form.birthday}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="年龄:">
                      {{form.age}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="性别:">
                      {{form.sex}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="打款账号:">
                      {{form.payBankCard}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="收款账号:">
                      {{form.receiveBankCard}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="打款银行开户行:">
                      {{form.payOpeningBank}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="收款银行开户行:">
                      {{form.receiveOpeningBank}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="联系电话:">
                      {{form.telPhone}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="联系地址:">
                      {{form.address}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="付款方式:" prop="investmentType">
                      {{form.investmentType}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="资产转让总额:"  prop='totalAssets'>
                      {{form.totalAssets}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="预期收益率:">
                    {{form.totalAssetsReturn}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="服务人员:" prop="salemanName">
                      {{form.salemanName}}
                  </el-form-item>
                </el-col>
                <el-col :span="8" v-if="form.receiptSellBackTime!=null">
                  回执回销时间：{{form.receiptSellBackTime}}
                </el-col> 
                <el-col :span="8">
                  <el-form-item label="财顾费:" prop="salemanName">
                      {{form.totalPcFee}}
                  </el-form-item>
                </el-col>  
              </el-row>
              <el-row>
                <el-col :span="8">
                    <el-form-item label="银行到账金额:">
                        {{form.bankEceivedAmount}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="手续费:">
                        {{form.bankFee}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="银行到账日期:">
                        {{form.bankReceivedDate}}
                    </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                    <el-form-item label="银行打款日期:">
                        {{form.payDate}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="是否启用试算数据:">
                      {{form.isEnableTrialData}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                    <el-form-item label="资产转让生效日:">
                       {{form.assetsTransferEffDate}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="预期投资退出日:">
                       {{form.expectInvestmentExitDate}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="预期退出天数:">
                       {{form.lastInvestmentExitDate}}
                    </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                    <el-form-item label="投资者预期收益:">
                       {{form.expectInvestmentIncome}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="预期分配总额:">
                       {{form.expectTotalRevenue}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="人民币（大写）:">
                       {{form.expectTotalRevenueCap}}
                    </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                    <el-form-item label="预期第一期收益:">
                       {{form.expectInvestmentIncome1}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="预期第二期收益:">
                       {{form.expectInvestmentIncome2}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="预期第三期收益:">
                       {{form.expectInvestmentIncome3}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="标准业绩:">
                    {{form.standardCoefficientFee}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                    <el-form-item label="实际投资退出日:">
                       {{form.realInvestmentExitDate}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="实际投资期限:">
                       {{form.actualInvestmentExitDate}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="投资者实际收益:">
                       {{form.realInvestmentIncome}}
                    </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                    <el-form-item label="实际投资退出日本息总额:">
                       {{form.realTotalRevenue}}
                    </el-form-item>
                </el-col>
                <el-col :span="16">
                    <el-form-item label="人民币（大写）:">
                       {{form.realTotalRevenueCap}}
                    </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                    <el-form-item label="实际第一期收益:">
                       {{form.realInvestmentIncome1}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="实际第二期收益:">
                       {{form.realInvestmentIncome2}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="实际第三期收益:">
                       {{form.realInvestmentIncome3}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="积分:">
                       {{form.integral}}
                    </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                    <el-form-item label="当前状态:">
                        {{form.status}}
                    </el-form-item>
                </el-col>
                <el-col :span="16">
                    <el-form-item label="驳回原因:">
                        {{form.remark}}
                    </el-form-item>
                </el-col>
              </el-row>
          </el-form>
      </el-dialog>
    </el-dialog>
  </div>
</template>
<script>
var productId=0;
var salemanId="";
var searchInfo={
  contractNo:"",
  salemanId:"",
  status:"",
  customerName:"",
  idCard:"",
  phone:"",
  productId:"",
  startAssetsTransferEffDate:"",
  endAssetsTransferEffDate:"",
  startInputTime:"",
  endInputTime:"",
  startReceiptSellBackTime:"",
  endReceiptSellBackTime:"",
  startLastInvestmentExitTiem:"",
  endLastInvestmentExitTiem:"",
  startBankReceivedDate:"",
  endBankReceivedDate:"",
  startRealInvestmentExitDate:"",
  endRealInvestmentExitDate:"",
  createdId:"",
}
export default {
  data() {
    return {
      inputTime: "", // 录入时间
      saleTime: "", // 开卖时间
      entryName: "", // 录入人
      productName: "", // 产品名称
      productIdList:[],
      productNameArray:[],
      inputProductNameLoading:false,
      dialogSaleShow: false, // 收益率弹框显示
      pageSize: 20,
      gridData: [],
      gridData2: [],
      gridData3: [],
      emps: [],
      keywords: "",
      beginDateScope: "",
      faangledoubleup: "fa-angle-double-up",
      faangledoubledown: "fa-angle-double-down",
      dialogTitle: "",
      multipleSelection: [],
      depTextColor: "#c0c4cc",
      nations: [],
      politics: [],
      positions: [],
      joblevels: [],
      totalCount: 1,
      currentPage: 1,
      deps: [],
      defaultProps: {
        label: "name",
        isLeaf: "leaf",
        children: "children"
      },
      dialogVisible: false,
      tableLoading: false,
      advanceSearchViewVisible: false,
      showOrHidePop2: false,
      pcFeeFormulaInfo: [],
      incomFromInvestmentFormulaInfo: [],
      exitTypeArr:[{label:"按天数退出",value:"00"},{label:"按日期退出",value:"01"}],
      productTypeArr: [
        {
          label: "普通产品",
          value: "0"
        },
        {
          label: "1+X产品",
          value: "1"
        }
      ],
      emp: {
        accountName: "",
        productName: "", // 产品名称
        standardCoefficient: "",
        pcFeeFormula: "",
        pcFeeName: "",
        incomFromInvestmentName: "",
        incomFromInvestmentFormula: "",
        lastInvestmentExitDate: "",
        productNo: "",
        exitType:"00",
        totalAssets: "",
        productType: "",
        earlyReminderTime: "",
        actualInvestmentExitDate: "",
        actualInvestmentExitTime:"",
        accountNo: "",
        openAccountBank: "",
        saleDate: "",
        firstReceiptData:"",
        lastReceiptData:"",
      },
      // 高级搜索
      senior:{
        contractNo:"",
        saleman: "",
        inputsalemanNameLoading: false,
        inputProductNameLoading:false,
        inputsalemanNameArray: [],
        productNameArray:[],
        status:"",
        statusArray:[],
        customerName:"",
        idcard:"",
        AssetsTransferEffDate:"",
        InputTime:"",
        ReceiptSellBackTime:"",
        LastInvestmentExitTiem:"",
        BankReceivedDate:"",
        RealInvestmentExitDate:"",
        phone:"",
        createdId:"",
        createdManArray:[],
      },
      trialSettingShow:false,
      trialSettingLoading:false,
      trialExitType:"00",
      trialInvestmentExitDate:"",
      trialInvestmentExitTime:"",
      trialStartDate:"",
      trialBankReceivedDate:"",
      trialAdministrationShow:false,
      trialTable:[],
      trialTableLoading:false,
      trialCurrentPage: 1,
      trialPageSize: 2000,
      trialTotalCount: 0,
      trialAdministrationInfoShow:false,
      trialAdministrationSearchShow:false,
      productInfoShow:false,
      productinfo:{},
      form: {
        contractNo: "",
        productName: "",
        standardCoefficient: 0,
        customerName: "",
        idCard: "",
        sex: "男",
        birthday: "",
        age: "",
        payBankCard: "",
        receiveBankCard: "",
        payOpeningBank: "",
        receiveOpeningBank: "",
        telPhone: "",
        address: "",
        totalAssets: "",
        totalAssetsReturn: 0,
        investmentType: "",
        salemanName: "",
        bankEceivedAmount: "",
        bankFee: "",
        bankReceivedDate: "",
        remark: "",
        assetsTransferEffDate: "",
        expectInvestmentExitDate: "",
        lastInvestmentExitDate: 0
      },
    };
  },
  mounted: function() {
    this.getRequest(
      "/formula/getListByType?formulaType=ASSETS_ADVISER_ADVISER"
      ).then(resp => {
      if (resp && resp.status == 200) {
        resp.data.obj.forEach((v, i) => {
          this.pcFeeFormulaInfo.push({
            label: v.formulaName,
            value: v.formulaId + "",
            indexVal: v.formulaId,
            realVal: v.formulaInfo
          });
        });
      }
    });
    this.getRequest(
      "/formula/getListByType?formulaType=INCOM_FROM_INVESTMENT"
      ).then(resp => {
      if (resp && resp.status == 200) {
        resp.data.obj.forEach((v, i) => {
          this.incomFromInvestmentFormulaInfo.push({
            label: v.formulaName,
            value: v.formulaId + "",
            indexVal: v.formulaId,
            realVal: v.formulaInfo
          });
        });
      }
    });
    this.getRequest("/common/getStatusList").then(
      resp => {
        if (resp && resp.data.status == 200) {
          this.senior.statusArray=resp.data.obj
        }
      }
    );
    this.getRequest("/common/getAllUser").then(
      resp => {
        if (resp && resp.data.status == 200) {
          this.senior.createdManArray=resp.data.obj
        }
      }
    );
    this.loadEmps();
  },
  methods: {
    closeModal() {
      this.dialogVisible = false;
      this.emptyEmpData();
      this.loadEmps();
    },

    lookThing(index) {
      this.dialogSaleShow = true;
      this.gridData = [];
      this.gridData2 = [];
      this.gridData3 = [];
      let result = JSON.parse(this.emps[index].incomFromInvestmentFormula);
      if (!(result.formulaType.indexOf("_1_X") > -1)) {
        result.formulaInfo.profitRateList.forEach((v, i) => {
          this.gridData.push({
            money: v.condition,
            year: v.profitRate
          });
        });
      } else {
        result.formulaList.forEach((item, idx) => {
          if (idx === 0) {
            item.profitRateList.forEach((v, i) => {
              this.gridData.push({
                money: v.condition,
                year: v.profitRate
              });
            });
          } else if(idx === 1){
            item.profitRateList.forEach((v, i) => {
              this.gridData2.push({
                money: v.condition,
                year: v.profitRate
              });
            });
          } else if(idx === 2){
            item.profitRateList.forEach((v, i) => {
              this.gridData3.push({
                money: v.condition,
                year: v.profitRate
              });
            });
          }
        });
      }
    },
    cancelSearch() {
      this.advanceSearchViewVisible = false;
      this.emptyEmpData();
      this.beginDateScope = "";
      this.loadEmps();
    },
    showAdvanceSearchView() {
      this.advanceSearchViewVisible = !this.advanceSearchViewVisible;
      this.keywords = "";
      if (!this.advanceSearchViewVisible) {
        this.currentPage = 1;
        this.emptyEmpData();
        this.beginDateScope = "";
        this.loadEmps();
      }
    },
    searchEmp() {
      let startTime = "";
      let endTime = "";
      let startSaleDate="";
      let endSaleDate="";
      if(this.inputTime){
        startTime = this.inputTime[0];
        endTime = this.inputTime[1];
      }
      if (this.saleTime) {
        startSaleDate = this.saleTime[0];
        endSaleDate = this.saleTime[1];
      }
      this.currentPage = 1;
      this.loadEmps({
        productIdList: this.productIdList,
        startTime,
        endTime,
        startSaleDate,
        endSaleDate,
      });
    },
    currentChange(currentChange) {
      this.currentPage = currentChange;
      this.loadEmps();
    },
    loadEmps(options) {
      var _this = this;
      this.tableLoading = true;
      this.postRequest("/query/product/mg", {
        pageIndex: this.currentPage,
        pageSize: this.pageSize,
        ...options
      }).then(res => {
        if (res.status == "200") {
          this.tableLoading = false;
          _this.emps = res.data.obj.rows;
          _this.totalCount = res.data.obj.total;
        }
      });
    },
    async showEditEmpView(row) {
      this.dialogVisible = true;
      this.dialogTitle = "查看信息";
      console.log(row);
      this.emp = row;
      this.emp.earlyReminderTime ? this.emp.earlyReminderTime : "";
      this.emp.actualInvestmentExitDate
        ? this.emp.actualInvestmentExitDate
        : "";
      this.emp.pcFeeFormula = this.pcFeeFormulaInfo.filter(item => {
        return this.emp.pcFeeName == item.label;
      });
      this.emp.pcFeeFormula = this.emp.pcFeeFormula[0].value;

      this.emp.incomFromInvestmentFormula = this.incomFromInvestmentFormulaInfo.filter(
        item => {
          return this.emp.incomFromInvestmentName == item.label;
        }
      );
      this.emp.incomFromInvestmentFormula = this.emp.incomFromInvestmentFormula[0].value;
    },
    productInfo(item){
      this.productInfoShow=true;
      this.getRequest("/query/product/productSummary?productId=" + item.productId).then(
          resp => {
            if (resp && resp.data.status == 200) {
              this.productinfo=resp.data.obj
            }
          }
      )
    },
    //试算设置
    trialSetting(item){
      console.log(item)
      productId=item.productId;
      this.trialSettingShow=true;
      this.trialInvestmentExitDate="";
      this.trialInvestmentExitTime="";
      this.trialStartDate="";
      this.trialBankReceivedDate="";
      if(!this.common.isNull(item.trialInvestmentExitDate)){
        this.trialExitType="00";
        this.trialInvestmentExitDate=item.trialInvestmentExitDate;
      }
      if(!this.common.isNull(item.trialInvestmentExitTime)){
        this.trialExitType="01";
        this.trialInvestmentExitTime=item.trialInvestmentExitTime;
      } 
      if(!this.common.isNull(item.trialStartDate)){
        this.trialStartDate=item.trialStartDate
      }
      if(!this.common.isNull(item.startBankReceivedDate)){
        this.trialBankReceivedDate=[item.startBankReceivedDate,item.endBankReceivedDate]
      }
    },
    //确认试算设置
    sureTrialSetting(){
      console.log(this.trialStartDate)
      console.log(this.trialBankReceivedDate)
      if(this.common.isNull(this.trialStartDate)){
        this.common.showToast('warning','请选择试算开始日期')
      }
      else if(this.common.isNull(this.trialBankReceivedDate)){
        this.common.showToast('warning','请选择银行到账日')
      }else{
        this.trialSettingLoading=true;
        this.postRequest("/query/product/trial_date_update",{
          productId:productId,
          exitType:this.trialExitType,
          trialInvestmentExitDate:this.trialInvestmentExitDate,
          trialInvestmentExitTime:this.trialInvestmentExitTime,
          trialStartDate:this.trialStartDate,
          startBankReceivedDate:this.trialBankReceivedDate[0],
          endBankReceivedDate:this.trialBankReceivedDate[1],
          }).then(resp=>{
            this.trialSettingLoading=false;
            if(resp &&resp.data.status==200){
              this.trialSettingShow=false;
              this.common.showToast('success','操作成功')
              this.loadEmps()
            }
        })
      } 
    },
    //搜索条件初始化
    clearSenior(){
      salemanId=""
      this.trialAdministrationSearchShow=false;
      this.senior=
      {
        contractNo:"",
        saleman: "",
        inputsalemanNameLoading: false,
        inputProductNameLoading:false,
        inputsalemanNameArray: [],
        productNameArray:[],
        status:"",
        statusArray:[],
        customerName:"",
        idcard:"",
        AssetsTransferEffDate:"",
        InputTime:"",
        ReceiptSellBackTime:"",
        LastInvestmentExitTiem:"",
        BankReceivedDate:"",
        RealInvestmentExitDate:"",
        phone:"",
        createdId:"",
        createdManArray:[],
      };
    },
    //试算类型更改
    trialExitTypeChange(val){
      this.trialExitType=val;
      this.trialInvestmentExitDate="";
      this.trialInvestmentExitTime="";
    },
    trialCurrentChange(currentChange){
      this.trialCurrentPage = currentChange;
      this.trialRequestInfo(productId,this.trialCurrentPage,this.trialPageSize)
    },
    trialRequestInfo(id, pageCount, pageSize){
      this.senior.AssetsTransferEffDate=this.senior.AssetsTransferEffDate ||[];
      this.senior.InputTime=this.senior.InputTime ||[];
      this.senior.ReceiptSellBackTime=this.senior.ReceiptSellBackTime ||[];
      this.senior.LastInvestmentExitTiem=this.senior.LastInvestmentExitTiem ||[];
      this.senior.BankReceivedDate=this.senior.BankReceivedDate ||[];
      this.senior.RealInvestmentExitDate=this.senior.RealInvestmentExitDate ||[];
      this.senior.AssetsTransferEffDate[0]=this.senior.AssetsTransferEffDate[0] || "";
      this.senior.AssetsTransferEffDate[1]=this.senior.AssetsTransferEffDate[1] || "";
      this.senior.InputTime[0]=this.senior.InputTime[0] || "";
      this.senior.InputTime[1]=this.senior.InputTime[1] || "";
      this.senior.ReceiptSellBackTime[0]=this.senior.ReceiptSellBackTime[0] || "";
      this.senior.ReceiptSellBackTime[1]=this.senior.ReceiptSellBackTime[1] || "";
      this.senior.LastInvestmentExitTiem[0]=this.senior.LastInvestmentExitTiem[0] || "";
      this.senior.LastInvestmentExitTiem[1]=this.senior.LastInvestmentExitTiem[1] || "";
      this.senior.BankReceivedDate[0]=this.senior.BankReceivedDate[0] || "";
      this.senior.BankReceivedDate[1]=this.senior.BankReceivedDate[1] || "";
      this.senior.RealInvestmentExitDate[0]=this.senior.RealInvestmentExitDate[0] || "";
      this.senior.RealInvestmentExitDate[1]=this.senior.RealInvestmentExitDate[1] || "";
      this.trialTableLoading=true;
      this.postRequest("/query/product/trial_product_mange", {
          contractNo: this.senior.contractNo,
          salemanId: salemanId,
          startInputTime: this.senior.InputTime[0],
          endInputTime: this.senior.InputTime[1],
          startReceiptSellBackTime: this.senior.ReceiptSellBackTime[0],
          endReceiptSellBackTime: this.senior.ReceiptSellBackTime[1],
          startLastInvestmentExitTiem: this.senior.LastInvestmentExitTiem[0],
          endLastInvestmentExitTiem: this.senior.LastInvestmentExitTiem[1],
          startBankReceivedDate: this.senior.BankReceivedDate[0],
          endBankReceivedDate: this.senior.BankReceivedDate[1],
          startRealInvestmentExitDate: this.senior.RealInvestmentExitDate[0],
          endRealInvestmentExitDate: this.senior.RealInvestmentExitDate[1],
          startAssetsTransferEffDate: this.senior.AssetsTransferEffDate[0],
          endAssetsTransferEffDate: this.senior.AssetsTransferEffDate[1],
          customerName: this.senior.customerName,
          idCard: this.senior.idcard,
          status: this.senior.status,
          telPhone: this.senior.phone,
          createdId:this.senior.createdId,
          productId: id,
          pageIndex: pageCount,
          pageSize: pageSize
        })
        .then(resp => {
            this.trialTableLoading = false;
            if (resp && resp.data.status == 200) {
              this.trialTable = resp.data.obj.rows;
              this.trialTotalCount = resp.data.obj.total;
              searchInfo={
                  contractNo:this.senior.contractNo,
                  salemanId:salemanId,
                  status:this.senior.status,
                  customerName:this.senior.customerName,
                  idCard:this.senior.idcard,
                  phone:this.senior.phone,
                  productId:id,
                  startAssetsTransferEffDate:this.senior.AssetsTransferEffDate[0],
                  endAssetsTransferEffDate:this.senior.AssetsTransferEffDate[1],
                  startInputTime:this.senior.InputTime[0],
                  endInputTime:this.senior.InputTime[1],
                  startReceiptSellBackTime:this.senior.ReceiptSellBackTime[0],
                  endReceiptSellBackTime:this.senior.ReceiptSellBackTime[1],
                  startLastInvestmentExitTiem:this.senior.LastInvestmentExitTiem[0],
                  endLastInvestmentExitTiem:this.senior.LastInvestmentExitTiem[1],
                  startBankReceivedDate:this.senior.BankReceivedDate[0],
                  endBankReceivedDate:this.senior.BankReceivedDate[1],
                  startRealInvestmentExitDate:this.senior.RealInvestmentExitDate[0],
                  endRealInvestmentExitDate:this.senior.RealInvestmentExitDate[1],
                  createdId:this.senior.createdId,
                }
            }
      });
    },
    //关闭试算管理
    closeTrialAdministration(done){
      this.clearSenior()
      done()
    },
    //点击试算管理
    trialAdministration(row){
      productId=row.productId;
      this.trialAdministrationShow=true;
      this.trialCurrentPage=1;
      this.trialRequestInfo(productId,this.trialCurrentPage,this.trialPageSize)
    },
    //确定试算管理搜索
    sureTrialAdministrationSearch(){
      this.trialCurrentPage=1;
      this.trialRequestInfo(productId,this.trialCurrentPage,this.trialPageSize)
    },
    //试算管理查看信息
    showTrialAdministrationInfo(item){
      console.log(item)
      this.trialAdministrationInfoShow=true;
      this.form = item;
    },
    // 输入服务人员
    inputsalemanNameMethod: function(query) {
      if (query !== "") {
        this.senior.inputsalemanNameLoading = true;
        this.getRequest("/auditor/matchingSaleman?salemanName=" + query).then(
          resp => {
            if (resp && resp.data.status == 200) {
              this.senior.inputsalemanNameArray = resp.data.obj;
            }
            this.senior.inputsalemanNameLoading = false;
          }
        );
      } else {
        this.senior.inputsalemanNameArray = [];
      }
    },
    // 服务人员发生变化
    salemanNameChange: function(e) {
      var that = this;
      if (e == "") {
        salemanId = "";
      } else {
        this.getRequest("/auditor/matchingSaleman?salemanName=" + e).then(
          resp => {
            if (resp && resp.data.status == 200) {
              salemanId = resp.data.obj[0].salemanId;
            }
          }
        );
      }
    },
    // 输入产品名称
    inputProductNameMethod(query){
      if (query !== "") {
        this.inputProductNameLoading = true;
        this.postRequest("/common/get_product_info",{
          searchContent:query
        }).then(
          resp => {
            if (resp && resp.data.status == 200) {
              this.productNameArray = resp.data.obj;
            }
            this.inputProductNameLoading = false;
          }
        );
      } else {
        this.productNameArray = [];
      }
    },
    // 产品名称发生变化
    productNameChange(e){
      var that = this;
      if (e == "") {
        this.productIdList=[];
      } else {  
        this.productIdList=[];
        for(let i=0;i<e.length;i++){  
          this.postRequest("/common/get_product_info",{
            searchContent:e[i]
          }).then(
          resp => { 
            if (resp && resp.data.status == 200) {
              this.productIdList.push(resp.data.obj[0].productId)
            }
          }
        );
        }
      }
    },
    //导出信息
    exportInfo(){
      var address=`/query/product/trial_product_export?contractNo=${searchInfo.contractNo}&&salemanId=${searchInfo.salemanId}&&startInputTime=${searchInfo.startInputTime}&&endInputTime=${searchInfo.endInputTime}&&startReceiptSellBackTime=${searchInfo.startReceiptSellBackTime}&&endReceiptSellBackTime=${searchInfo.endReceiptSellBackTime}&&startLastInvestmentExitTiem=${searchInfo.startLastInvestmentExitTiem}&&endLastInvestmentExitTiem=${searchInfo.endLastInvestmentExitTiem}&&startBankReceivedDate=${searchInfo.startBankReceivedDate}&&endBankReceivedDate=${searchInfo.endBankReceivedDate}&&productId=${searchInfo.productId}&&startAssetsTransferEffDate=${searchInfo.startAssetsTransferEffDate}&&endAssetsTransferEffDate=${searchInfo.endAssetsTransferEffDate}&&customerName=${searchInfo.customerName}&&status=${searchInfo.status}&&idCard=${searchInfo.idCard}&&startRealInvestmentExitDate=${searchInfo.startRealInvestmentExitDate}&&endRealInvestmentExitDate=${searchInfo.endRealInvestmentExitDate}&&telPhone=${searchInfo.phone}&&createdId=${searchInfo.createdId}`; 
      this.common.downloadFile(address); 
    },
    emptyEmpData() {
      this.emp = {
        accountName: "",
        productName: "", // 产品名称
        standardCoefficient: "",
        pcFeeFormula: "",
        pcFeeName: "",
        incomFromInvestmentName: "",
        incomFromInvestmentFormula: "",
        lastInvestmentExitDate: "",
        productNo: "",
        totalAssets: "",
        productType: "",
        accountNo: "",
        openAccountBank: "",
        earlyReminderTime: "",
        actualInvestmentExitDate: "",
        actualInvestmentExitTime: "",
        saleDate: "",
        exitType:"00",
        firstReceiptData:"",
        lastReceiptData:"",
      };
    }
    
  }
};
</script>
<style scoped>
.el-input{
  width: 180px;
}
.product-mg .el-dialog__body {
  padding-top: 0px;
  padding-bottom: 0px;
}

.el-dialog__body .el-table {
  margin-bottom: 10px;
}

.product-mg .slide-fade-enter-active {
  transition: all 0.8s ease;
}

.product-mg .el-row {
  margin-bottom: 10px;
}

.product-mg .slide-fade-leave-active {
  transition: all 0.8s cubic-bezier(1, 0.5, 0.8, 1);
}

.product-mg .slide-fade-enter,
.product-mg .slide-fade-leave-to {
  transform: translateX(10px);
  opacity: 0;
}
.senior{
  margin-bottom: 10px;
  border: 1px;
  border-radius: 5px;
  border-style: solid;
  padding: 10px;
  box-sizing:border-box;
  border-color: #20a0ff
}
.senior .el-row{
  margin-bottom: 20px;
}
.senior .el-input{
  width:200px !important;
}
.senior .el-date-editor{
  width: 200px !important;
}
</style>
